/* JSDAS
* Copyright (C) 2008-2009 Bernat Gel
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

var JSDAS = JSDAS || {};
JSDAS.Demo = JSDAS.Demo || {};

JSDAS.Demo.setStatus = function(msg, autohide, cls) {
	if(autohide == undefined){
		autohide = true;
	}
	var status_div = document.getElementById('status');
	if(!status_div) {
		status_div = document.createElement('div');
		status_div.id = "status";
		status_div.setAttribute('class', 'status top_floating '+cls);
		document.body.appendChild(status_div);
	}
	if(JSDAS.Demo.statusTimeout) clearTimeout(JSDAS.Demo.statusTimeout);
	if(autohide) JSDAS.Demo.statusTimeout = setTimeout('JSDAS.Demo.hideStatus();', 2000);
  
	status_div.innerHTML = msg;
	JSDAS.Demo.showStatus(); //just to make sure it's visible
}

JSDAS.Demo.hideStatus = function() {
  	var status_div = document.getElementById('status');
	if(status_div) {
	  status_div.style.display = 'none';
	}
}

JSDAS.Demo.showStatus = function() {
  	var status_div = document.getElementById('status');
	if(status_div) {
	  status_div.style.display = '';
	}
}
